<?php
include_once("initlite.php");
$rate = $c->rate_limit_status();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>清爽版微博 - API频次状态</title>
<style>
table {
	margin: 0 auto;
	border: black 1px solid;
}

th {
	border: gray 1px solid;
	background: Gainsboro;
}

td {
	border:  gray 1px solid;
}
</style>
</head>
<body>
<table>
<tr>
	<th colspan=4>分类API调用频率限制</th>
</tr>
<tr>
	<td>API类别</td><td>总限制次数</td><td>时间单位</td><td>剩余次数</td>
</tr>
<?php
for($i=0; $i<count($rate["api_rate_limits"]); $i++){
	$api = $rate["api_rate_limits"][$i]["api"];
	$limit = $rate["api_rate_limits"][$i]["limit"];
	$limit_time_unit = $rate["api_rate_limits"][$i]["limit_time_unit"];
	$remaining_hits = $rate["api_rate_limits"][$i]["remaining_hits"];
?>
<tr>
	<td><?php echo $api; ?></td><td><?php echo $limit; ?></td><td><?php echo $limit_time_unit; ?></td><td><?php echo $remaining_hits; ?></td>
</tr>
<?php
}
?>
<tr>
	<th colspan=4>当前用户及服务器API调用频次状态</th>
</tr>
<tr>
	<td colspan=2>服务器总限制次数</td><td colspan=2><?php echo $rate["ip_limit"]; ?></td>
</tr>
<tr>
	<td colspan=2>时间单位</td><td colspan=2><?php echo $rate["limit_time_unit"]; ?></td>
</tr>
<tr>
	<td colspan=2>服务器剩余次数</td><td colspan=2><?php echo $rate["remaining_ip_hits"]; ?></td>
</tr>
<tr style="color: red;">
	<td colspan=2>当前用户剩余次数</td><td colspan=2><?php echo $rate["remaining_user_hits"]; ?></td>
</tr>
<tr>
	<td colspan=2>下次重置时间</td><td colspan=2><?php echo $rate["reset_time"]; ?></td>
</tr>
<tr>
	<td colspan=2>距下次重置时间剩余时间（秒）</td><td colspan=2><?php echo $rate["reset_time_in_seconds"]; ?></td>
</tr>
<tr>
	<td colspan=2>当前用户总限制次数</td><td colspan=2><?php echo $rate["user_limit"]; ?></td>
</tr>
</table>
</body>
</html>